Dynamic instantiation of fields on a page for any Class type

02 Oct '13, 11:18 PM
27,210 Views
Forum Forum Starter - Level 2

Hi there,

I have an abstract class called Position that maps to the persistence layer. The database table (and mutator/descriptor) has field for the position description, the fully-qualified-name of the sub-class and encoded (base64) definition. The definition field is a text data type, so that each sub-class of Position (e.g.: GpsPosition) will populate the definition field as it is filled in.

The purpose of this is so that any type of Position sub-class with any number of fields (and data types) can be encoded/decoded into a string/xml representation and saved in the standardized persistence layer. E.g.: Gps has Latitude/Longitude fields and encodes to the single text database fields, RDBMS has TableName/PrimaryKeyFieldName/PrimaryKeyId fields that encode to the single text database field. etc.

I want to have the generic Position table associated to a configuration page. A drop list of Position sub-classes will be populated with the available type of position that can be selected by using reflection for the sub-classes that extend the Position abstract class.

My question: Does anyone have a suggested solution for dynamically creating the fields on the page according to the fields. My initial thoughts are that I'll have to use a Custom Unit that will return a purpose-specific bean containing the encoded class. The javascript will have to interrogate the class and the unit.template will have to dynamically create the html form on the page.

If I get this working and create a design pattern of "description, FQN, encodedDefinition" would that be of use to others?

 
x 0
Follow
Answer Answer at this question and get points!
No answers yet
Answer at this question and get points!

Related questions

Ajax and FCK Editor (WebRatio 5.x) Ajax onchange and jQuery 2.x (with migrate plugin) incompatible Ajax on change selection field and modify units Autocomplete template Automatic date in form Automatic file upload BPMN: URL field ckeditor - change directory for the browser Clean a form Como crear cambio de contraseƱa Como tener dos botones juntos en un formulario independientes de una accion? Como usar la funciĆ³n autocomplete en un field Compare with the current time coupled mandatory fields Cryptic error when submitting a form Disabilitare campi durante evento AJAX Drop down menu question Dudas sobre modelado(Data Flow,Forms y Operation Create) Dynamic attribute/field names. Possible? Empty record mistakenly saved entry form logic. Entry Unit - Default field timestamp Entry Unity, Field Date Type Error Field as link soruce Form element Form template Getting the absolute path of a RTXBLOBData Hide form until a flow is triggered Hiding form components based on page conditions Hierarchy component How I can receive the primary key value after adding into database from OK Port. How to redirect to the correct site view after a successful login attempt input mask Multi Entry Unit: How to forward only checked rows? Multi-Image Upload Multiple forms on one page. HTML5 input attributes. Possible? (2 questions) multi selections field problem Multi Selects didn't work in update page Prelevare la chiave del record da una Selection Field in una Multiple Form Problem saving multi selection from input Progress bar when uploading big file(s) in a form? Pulire URL Redirecting users to another site view Resize fields Search by Selector component does not work selection fields on cascade Select multiple files for upload Setting Upload directory Showing items that have a relation with an entity Slot in Selection Field Update fields based on selection of other fields Updating attributes of an entity upload file and the move it to other location upload file html Uppercase Uso de la componente chart de webRatio Validacion validation fields Value Length (Min) fails to validate when field is empty? WebRation - Create Navigation diagram What are the new features of WebRatio 6.1? which of these three models is closer to webratio/ifml way of creating web applications